$(function() {
    //ROTATING BILLBOARD

    function Banner() {
        setInterval( "slideSwitch()", 6000 );
    }
    Banner();


    //SOCIAL ICONS

    $('.js_hover1 > a > img').hover(function() {
        //alert('sad');
        $(this);
        $(this).stop().css("borderBottom", "solid 1px red").animate({"marginBottom" : "5px"}, 500, "swing");
            }, function() {
                $(this).stop().css("borderBottom", "none").animate({"marginBottom" : "0px"}, 500, "easeOutBounce");
        });


    //DROPDOWN

    $('nav li ul').hide().removeClass('fallback');
    $('nav li').hover(
        function () {
            $('ul', this).stop().slideDown(300);
        },
        function () {
            $('ul', this).stop().slideUp(100);
        }
    );
});




function slideSwitch() {
    var $active = $('#billboard_big div.active');

    if ( $active.length == 0 ) $active = $('#billboard_big div:last');
    var $next = $active.next().length ? $active.next() : $('#billboard_big div:first');
    $active.addClass('last-active');



    $next.css({ "left" : "-100%" })
        .addClass('active')
        .animate({ "left" : "0%" }, 2000, "easeInQuint", function() {
            $active.removeClass('active last-active');
        });

    //ADD and REMOVE SMALL BILLBOARD BORDER COLOR - RED
    var $active_classes = new Array();
    $active_classes = $next.attr('class').split(' ');
    $('.billboard_small').stop().delay(800).animate({ "borderColor" : "#181818" }, "slow");
    $('.billboard_small.' + $active_classes[0]).stop().delay(800).animate({ "borderColor" : "red" }, "slow");
    //alert ('#billboard_small .' + $active_classes[0]);

    //just a test
}